package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.CourseAttachment;
import com.ruoyi.system.mapper.CourseAttachmentMapper;
import com.ruoyi.system.service.CourseAttachmentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 课程附件表(CourseAttachment)表服务实现类
 */
@Service("courseAttachmentService")
public class CourseAttachmentServiceImpl implements CourseAttachmentService {
    @Resource
    private CourseAttachmentMapper courseAttachmentMapper;

    /**
     * 通过ID 查询单条数据
     * @param courseId 主键
     *
     * @return 实例对象
     */

    @Override
    public CourseAttachment queryById(Long courseId) {
        return this.courseAttachmentMapper.queryById(courseId);
    }

    /**
     * 新增数据
     *
     * @param courseAttachment 实例对象
     * @return 实例对象
     */

    @Override
    public CourseAttachment insert(CourseAttachment courseAttachment) {
        this.courseAttachmentMapper.insert(courseAttachment);
        return courseAttachment;
    }

    /**
     * 修改数据
     *
     * @param courseAttachment 实例对象
     * @return 实例对象
     */
    @Override
    public CourseAttachment update(CourseAttachment courseAttachment) {
        this.courseAttachmentMapper.update(courseAttachment);
        return this.queryById(Long.getLong(courseAttachment.getCourseId()));
    }


}
